#ifndef DRETANGLE_H
#define DRETANGLE_H
#include <iostream>


/*****************************************************************
 *
 *
 *
 *****************************************************************/
class DRetangle
{
public:
	DRetangle( double x1 = 0, double y1 = 0, 
	           double x2 = 0, double y2 = 0 );
	virtual ~DRetangle();
	
	inline double getLeftLowX() const { return m_x1; }
	inline double getLeftLowY() const { return m_y1; }
	
	inline double getUpRightX() const { return m_x2; }
	inline double getUpRightY() const { return m_y2; }
	
	inline double getWidth() const { return m_x2 - m_x1; }
	inline double getHeight() const { return m_y2 - m_y1; }
	
	double* getCenter() const;
	bool contains( double px, double py ) ; 
	
	void extend( double px, double py );
	void extend( DRectangle& r );
	
	bool isIntersect(  DRectangle& that, double tolerance = 0, double* distance = 0 );
	bool isIntersect2( DRectangle& that );
	
	friend std::ostream& operator<<( std::ostream& out, DRectangle& rectangle );

private:
	double m_y2;
	double m_x2;
	double m_y1;
	double m_x1;
};




















#endif